package com.gc.server.entity;


import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Setter;
import lombok.Getter;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

import java.math.BigDecimal;

/**
 * 日程实体
 * 表名 todo
 *
 * @author hxf
 * @email 505860922@qq.com
 * @date Sun Apr 05 23:13:26 CST 2020
 */
@Setter
@Getter
public class TodoEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    //
    private Long id;
    //计划ID
    private Long planId;
    //时间
    private Date date;
    //起止时间
    Date[] dates;
    //ENUM-类型:"VISIT-药店拜访","SEND-试用装发放","ACT-促销活动"
    private Integer type;
    //主题
    private String title;
    //总评分
    private BigDecimal score;
    //定位信息
    private String address;
    //总结
    private String summary;
    //ENUM-状态:"TODO-未完成,WAIT-待审核","SCORE-已评分"
    private Integer status;
    //业务员ID
    private Long userId;
    //IMG-价格维护照片
    private String priceImg;
    //IMG-陈列拍照
    private String displayImg;
    //IMG-气氛英文
    private String airImg;
    //IMG-合照
    private String groupImg;
    //店员沟通
    private String chat;
    //幼儿园名称
    private String school;
    //ENUM-音频:"NO-没有","YES-有"
    private Integer audio;
    //发放数量
    private Integer sendNum;
    //IMG-发放图片
    private String sendImg;
    //活动名称
    private String actName;
    //销售数量
    private Integer sellNum;
    //新增会员数量
    private Integer userNum;
    //定位时间
    private Date addressTime;
    //起止时间
    Date[] addressTimes;
    //提交时间
    private Date doneTime;
    //起止时间
    Date[] doneTimes;
    //考核时间
    private Date scoreTime;
    //起止时间
    Date[] scoreTimes;
    //价格维护拍照时间
    private Date priceTime;
    //起止时间
    Date[] priceTimes;
    //陈列拍照时间
    private Date displayTime;
    //起止时间
    Date[] displayTimes;
    //气氛拍照时间
    private Date airTime;
    //起止时间
    Date[] airTimes;
    //合照时间
    private Date groupTime;
    //起止时间
    Date[] groupTimes;
    //发放时间
    private Date sendTime;
    //起止时间
    Date[] sendTimes;
    //IMG-销售照片
    private String sellImg;
    //销售照片时间
    private Date sellTime;
    //起止时间
    Date[] sellTimes;

    private BigDecimal imgScore;

    private String adminName;

    private Date adminTime;

    Date[] adminTimes;



    public TodoEntity(){

    }

    //逗留时间 完成时间 定位时间
    public long getDurHour(){
        if(this.addressTime!=null&&this.doneTime!=null){
          return   (this.doneTime.getTime()-this.addressTime.getTime())/(1000*60);
        }
        return 0;
    }

    /**
     * 新建一个日程
     * @param planId
     * @param date
     * @param type
     * @param title
     * @param userId
     */
    public TodoEntity(Long planId, Date date, Integer type, String title, Integer status, Long userId) {
        this.planId = planId;
        this.date = date;
        this.type = type;
        this.title = title;
        this.status = status;
        this.userId = userId;
    }
}
